import request from '@/utils/request'

//获取所属代理商
export function getAgentList(params) {
  return request({
    url: '/system/user/list',
    method: 'get',
    params
  })
}

//新增代理商
export function addAgent(data) {
  return request({
    url: '/system/user',
    method: 'post',
    data
  })
}

//修改代理商
export function updateAgent(data) {
  return request({
    url: '/system/user/update',
    method: 'post',
    data
  })
}

//获取信息列表
export function getNoticeList(params) {
  return request({
    url: '/terminal/notice/list',
    method: 'get',
    params
  })
}

//处理信息
export function apiHandleMsg(data) {
  return request({
    url: '/terminal/notice/handleMsg',
    method: 'post',
    data
  })
}


//获取用户总览
export function getUserStat(params) {
  return request({
    url: '/customer/statistics',
    method: 'get',
    params
  })
}

//获取用户统计列表
export function getUserStatList(params) {
  return request({
    url: '/customer/statisticsList',
    method: 'get',
    params
  })
}

//获取订单总览
export function getOrderStat(params) {
  return request({
    url: '/order/statistics',
    method: 'get',
    params
  })
}

//获取订单统计列表
export function getOrderStatList(params) {
  return request({
    url: '/order/statisticsList',
    method: 'get',
    params
  })
}

//代理商统计
export function getProviderStat(params) {
  return request({
    url: '/terminal/statistics',
    method: 'get',
    params
  })
}

//获取终端列表
export function getTerminalList(params) {
  return request({
    url: '/terminal/list',
    method: 'get',
    params
  })
}

//新增终端列表
export function addTerminal(data) {
  return request({
    url: '/terminal/add',
    method: 'post',
    data
  })
}

//修改终端列表
export function updateTerminal(data) {
  return request({
    url: '/terminal/update',
    method: 'post',
    data
  })
}

//删除终端列表
export function delTerminal(ids) {
  return request({
    url: `/terminal/${ids}`,
    method: 'delete'
  })
}


//获取订单列表
export function getOrderList(params) {
  return request({
    url: '/order/queryOrderList',
    method: 'get',
    params
  })
}

//获取用户管理列表
export function getUserList(params) {
  return request({
    url: '/customer/queryList',
    method: 'get',
    params
  })
}

//获取订单详情
export function getOrderDetail(params) {
  return request({
    url: '/customer/queryOrderListByUid',
    method: 'get',
    params
  })
}

//获取车队用户列表
export function getFleetUser(params) {
  return request({
    url: '/fleet/userList',
    method: 'get',
    params
  })
}

//获取车队详情
export function getFleetUserList(params) {
  return request({
    url: '/fleet/list',
    method: 'get',
    params
  })
}

//新增车队
export function addFleet(data) {
  return request({
    url: '/fleet/add',
    method: 'post',
    data
  })
}

//编辑车队
export function updateFleet(data) {
  return request({
    url: '/fleet/update',
    method: 'post',
    data
  })
}

//删除车队成员
export function delFleet(data) {
  return request({
    url: '/fleet/unbind',
    method: 'post',
    data
  })
}

//添加车队成员
export function bindFleet(data) {
  return request({
    url: '/fleet/bind',
    method: 'post',
    data
  })
}

//获取套餐列表
export function getPackageList(params) {
  return request({
    url: '/recharge/package/list',
    method: 'get',
    params
  })
}

//新增套餐
export function addPackage(data) {
  return request({
    url: '/recharge/package',
    method: 'post',
    data
  })
}

//修改套餐
export function updatePackage(data) {
  return request({
    url: '/recharge/package',
    method: 'put',
    data
  })
}

//删除套餐
export function delPackage(ids) {
  return request({
    url: `/recharge/package/${ids}`,
    method: 'delete'
  })
}

//获取广告列表
export function getBannerList(params) {
  return request({
    url: '/banner/list',
    method: 'get',
    params
  })
}

//新增广告
export function addBanner(data) {
  return request({
    url: '/banner',
    method: 'post',
    data
  })
}

//修改广告
export function updateBanner(data) {
  return request({
    url: '/banner',
    method: 'put',
    data
  })
}

//删除广告
export function delBanner(ids) {
  return request({
    url: `banner${ids}`,
    method: 'delete'
  })
}

//修改密码
export function changePassword(data) {
  return request({
    url: `/system/user/profile/updatePwd?oldPassword=${data.oldPassword}&newPassword=${data.newPassword}`,
    method: 'post',
    // data
  })
}

//获取车队列表
export function getFleetInfoList(params) {
  return request({
    url: '/fleet/queryFleetList',
    method: 'get',
    params
  })
}

//绑定终端
export function bindTerminal(data) {
  return request({
    url: '/fleet/terminal/bind',
    method: 'post',
    data
  })
}

//获取二维码
export function getTerminalCode(terminalNo) {
  return request({
    // url: '/terminal/genTerminalCode?url=https://saas.jspercent.com/urea-mini?terminalNo=' + terminalNo,
    url: '/terminal/genTerminalCode?url=https://saas.jspercent.com/urea-newmp?terminalNo=' + terminalNo,
    method: 'get',
    responseType:'blob'
  })
}
